﻿<Window x:Class="Avaxo.DlrPad.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:avaxo="clr-namespace:Avaxo.DlrPad"
    xmlns:Collections="clr-namespace:System.Collections;assembly=mscorlib"
    xmlns:Console="clr-namespace:Avaxo.Console;assembly=Avaxo.Console"
    xmlns:Scripting="clr-namespace:Avaxo.Scripting;assembly=Avaxo.Scripting"
    Title="DLR Pad" WindowState="Maximized" Height="480" Width="640">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition />
            <RowDefinition/>
            <RowDefinition Height="20" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <avaxo:ConsoleControl x:Name="console" Grid.Row="1" Grid.Column="0" Margin="0 0 5 0" />

        <StatusBar Grid.Row="3" Height="20" Grid.ColumnSpan="2">
            <StatusBarItem x:Name="infoStatusItem" Content="DLR Pad - interactive programming with XAML and DLR"/>
        </StatusBar>

        <Frame Grid.Row="1" Grid.Column="1" x:Name="contentFrame" NavigationUIVisibility="Hidden" ContentRendered="OnFrameContentRendered" >
            <Frame.LayoutTransform>
                <ScaleTransform ScaleX="{Binding ElementName=zoomCombo, Path=SelectedValue}" ScaleY="{Binding ElementName=zoomCombo, Path=SelectedValue}"/>
            </Frame.LayoutTransform>
        </Frame>

        <ScrollViewer Grid.Row="2" Grid.ColumnSpan="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <avaxo:XamlTextBox x:Name="xamlTextBox" Margin="0 5 0 0" XamlParsed="OnXamlParsed" XamlParseError="OnXamlParseError" 
                Text="&lt;Button Name=&quot;button&quot; Content=&quot;This is a test button. You can access it in the console window using its name 'button'.&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; /&gt;"
                FontSize="{Binding Path=Text, ElementName=fontSizeCombo}"/>
        </ScrollViewer>

        <GridSplitter Grid.Row="1" Grid.Column="0" Width="5" VerticalAlignment="Stretch" />
        <GridSplitter Grid.Row="2" Grid.ColumnSpan="2" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Top" />

        <ToolBarTray Grid.ColumnSpan="2" >
            <ToolBar>
                <ComboBox Width="100" SelectionChanged="OnLanguageChanged" x:Name="languagesCombo" DisplayMemberPath="LanguageName"
                    ItemsSource="{x:Static Scripting:LanguageEngine.Engines}" SelectedItem="{x:Static Scripting:LanguageEngine.DefaultEngine}" >
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
            </ToolBar>
            <ToolBar>
                <ComboBox Width="50" x:Name="fontSizeCombo" SelectedIndex="3" IsEditable="True">
                    <ComboBoxItem>8</ComboBoxItem>
                    <ComboBoxItem>10</ComboBoxItem>
                    <ComboBoxItem>11</ComboBoxItem>
                    <ComboBoxItem>12</ComboBoxItem>
                    <ComboBoxItem>14</ComboBoxItem>
                    <ComboBoxItem>16</ComboBoxItem>
                    <ComboBoxItem>18</ComboBoxItem>
                    <ComboBoxItem>20</ComboBoxItem>
                    <ComboBoxItem>22</ComboBoxItem>
                    <ComboBoxItem>24</ComboBoxItem>
                    <ComboBoxItem>26</ComboBoxItem>
                    <ComboBoxItem>28</ComboBoxItem>
                    <ComboBoxItem>36</ComboBoxItem>
                    <ComboBoxItem>48</ComboBoxItem>
                </ComboBox>
            </ToolBar>
            <ToolBar>
                <ComboBox Width="80" x:Name="zoomCombo" SelectedIndex="3" SelectedValuePath="Tag">
                    <ComboBoxItem Tag="0.25">25%</ComboBoxItem>
                    <ComboBoxItem Tag="0.5">50%</ComboBoxItem>
                    <ComboBoxItem Tag="0.75">75%</ComboBoxItem>
                    <ComboBoxItem Tag="1">100%</ComboBoxItem>
                    <ComboBoxItem Tag="2">200%</ComboBoxItem>
                    <ComboBoxItem Tag="5">500%</ComboBoxItem>
                </ComboBox>
            </ToolBar>
        </ToolBarTray>

    </Grid>

</Window>
